package com.exam.meituan;

import java.util.Scanner;

/**
 * date:
 * description:
 */
public class Solution101 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        for (int i = 0; i < T; i++) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            if(x > y) {
                int tmp = x;
                x = y;
                y = tmp;
            }
            if(y >= 2 * x) {
                System.out.println(x);
            } else {
                int num = (x + y) / 3;
                System.out.println(num);
            }
        }
    }
}
